Using Connectivity Watcher
This sample enables you to test the Connectivity Watcher and see the Screen Connectivity Watcher event in the Automation Portal.
How The Sample Works
This sample project does the following:
1. | The Watcher sample project includes a Restart application workflow. In this workflow, the Win32SimpleApp.exe application is started, a screen element recognized, and then the application is closed. This is repeated 120 times. The ObservationCount is incremented each time the element is recognized - this can be viewed in the Connectivity Watcher Monitor. |
2. | Once the ObservationCount exceeds 120, you can modify ("break") the screen element identification so that the screen element will no longer be recognized. |
3. | When the workflow runs the next time (with the ObservationCount now at 121), it cannot locate the screen element, and a Connectivity Watcher Event is thrown. |
4. | This Screen Connectivity Watcher event appears in the Automation Portal. The Connectivity Watcher Exception includes the following details: Parameter Name, Project Name, Agent Name, Computer Name, Process Name, URL, Screen Element Name, Occurrence Time, Solution Version and Screen Element Descriptor. |
Sample Project Structure
This Watcher project (child) is referenced by the watcherSolution (parent) which is the solution that is published. If any changes are made to the referenced (child) project, then the parent solution must be be republished so that RTClient can pick up the new version of the solution to execute.
The Watcher project contains a screen element captured from the Win32SimpleApp test application.
In the Watcher project, in the Identification tab, note that the My Window Class Name is: EDIT.
The Watcher project contains a Restart application workflow that executes a loop 120 times, executing the application and closing the application. This means that the screen element is recognized 120 times.
The watcherSolution project includes a simple workflow that executes the Restart application workflow in the Watcher child project.
Testing the Project
To test the project:
1. | Download the project file here. |
2. | Copy Win32SimpleApp.exe to C:\Temp. |
3. | Publish and run the watcherSolution solution. |
4. | The workflow runs and executes the application 120 times (and recognizes the screen element a corresponding number of times). |
5. | The ObservationCount can be viewed in the Connectivity Watcher Monitor (WatcherMonitor.exe). |
6. | Now modify the identification of the screen element, for example, in the Watcher project , in the Identification tab, set the My Window Class Name is: EDIT11. |
7. | Re-publish the solution. The ObservationCounter is not reset on publishing and is 120. |
8. | Run the workflow again. |
9. | The Screen Connectivity Watcher event is thrown as the RTClient cannot find the required screen element (the ObservationCounter is 121) and the event appears in the Automation Portal. |